package com.lesso.lpq.sunflower.resource.config;


import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * RabbitMQConfig
 *
 * @author zqz
 * @since 2025-07-07
 */
@Configuration
public class RabbitMQConfig {

    public static final String SUNFLOWER_EXCHANGE = "sunflower";
    public static final String SUNFLOWER_QUEUE = "sunflower.queue";
    public static final String SUNFLOWER_ROUTING_KEY = "sunflower.queue";

    @Bean
    public Exchange directExchange() {
        return new DirectExchange(SUNFLOWER_EXCHANGE);
    }

    @Bean
    public Queue queue() {
        return new Queue(SUNFLOWER_QUEUE);
    }

    @Bean
    public Binding binding(Exchange directExchange, Queue queue) {
        return BindingBuilder.bind(queue).to(directExchange).with(SUNFLOWER_ROUTING_KEY).noargs();
    }
}